package com.theo.mapper;

import com.theo.entity.RumourInfo;
import com.baomidou.mybatisplus.core.mapper.BaseMapper;
import org.apache.ibatis.annotations.Select;
import org.springframework.stereotype.Repository;

import java.util.List;

/**
 * <p>
 *  Mapper 接口
 * </p>
 *
 * @author 方涛
 * @since 2021-02-02
 */
@Repository
public interface RumourInfoMapper extends BaseMapper<RumourInfo> {

    int saveRumourInfo(RumourInfo rumourInfo);

    int deleteRumourInfo(Integer id);

    int updateRumourInfo(Integer id);

    @Select("SELECT r.`rumour_id`,r.`rumour_content`,r.`user_id`,u.`user_name`,u.`phone`,r.`is_refuted`,r.`tag`,r.`create_time`\n" +
            "FROM `rumour_info` r INNER JOIN `user_info` u\n" +
            "ON r.`user_id`=u.`user_id`")
    List<RumourInfo> queryAllRumourInfo();

    RumourInfo queryRumourInfoById(Integer id);
}
